using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Xml;
using Oracle.ManagedDataAccess.Types;
using OracleInternal.Common;
using OracleInternal.ServiceObjects;
using OracleInternal.SqlAndPlsqlParser.LocalParsing;

namespace Oracle.ManagedDataAccess.Client
{
	[Designer("Oracle.VsDevTools.OracleVSGCommandDesigner, Oracle.VsDevTools, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=X86", typeof(IDesigner))]
	[SecurityPermission(SecurityAction.Assert, ControlThread = true)]
	public sealed class OracleCommand : DbCommand, ICloneable
	{
		internal OracleCommandImpl m_commandImpl;

		private OracleConnection m_connection;

		private string m_commandText;

		private string m_pooledCmdText;

		private CommandType m_commandType = CommandType.Text;

		private OracleDataReader m_cachedReader;

		private bool m_cmdTxtModified = true;

		private int m_rowsAffected = -1;

		private bool m_designTimeVisible = true;

		private int m_commandTimeout;

		private OracleParameterCollection m_parameters;

		internal bool m_modified;

		internal bool m_disposed;

		internal int m_initialLongFS;

		internal int m_clientInitialLOBFS;

		internal const int m_internalInitialJSONFS = 33554432;

		private UpdateRowSource m_updatedRowSource = UpdateRowSource.Both;

		private bool m_bExecuteInProgress;

		internal OracleNotificationRequest m_NTFNReq;

		internal bool m_NTFNAutoEnlist = true;

		internal const int m_rowsToFetch = 1024;

		internal OracleRefCursor[] m_implicitRefCursors;

		internal bool m_returnPSTypes;

		private Type[] m_expectedColumnTypes;

		internal bool m_isFromEF;

		private bool m_addRowId;

		private bool m_addToStatementCache = true;

		private int m_arrayBindCount;

		private bool m_bBindByName = ConfigBaseClass.m_BindByName;

		private long m_fetchSize = ConfigBaseClass.m_FetchSize;

		private OracleXmlCommandType m_xmlCommandType;

		private OracleXmlQueryProperties m_xmlQueryProperties;

		private OracleXmlSaveProperties m_xmlSaveProperties;

		private WeakReference m_lastReaderWeakRef;

		internal Type[] ExpectedColumnTypes
		{
			get
			{
				return m_expectedColumnTypes;
			}
			set
			{
				m_expectedColumnTypes = value;
			}
		}

		[Category("Behavior")]
		[DefaultValue(false)]
		[Description("")]
		public bool AddRowid
		{
			get
			{
				return m_addRowId;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_addRowId != value)
				{
					m_addRowId = value;
					m_modified = true;
					m_cmdTxtModified = true;
					if (m_commandImpl != null)
					{
						m_commandImpl.m_addRowid = m_addRowId;
					}
				}
			}
		}

		[Description("")]
		[DefaultValue(true)]
		[Category("Behavior")]
		public bool AddToStatementCache
		{
			get
			{
				return m_addToStatementCache;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				m_addToStatementCache = value;
				if (m_commandImpl != null)
				{
					m_commandImpl.m_addToStatementCache = m_addToStatementCache;
				}
			}
		}

		[DefaultValue(0)]
		[Browsable(false)]
		public int ArrayBindCount
		{
			get
			{
				return m_arrayBindCount;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_arrayBindCount != value)
				{
					if (value < 0)
					{
						throw new ArgumentException();
					}
					m_arrayBindCount = value;
					m_modified = true;
					if (m_commandImpl != null)
					{
						m_commandImpl.m_arrayBindCount = m_arrayBindCount;
					}
				}
			}
		}

		[Browsable(false)]
		[DefaultValue(null)]
		public long[] ArrayBindRowsAffected
		{
			get
			{
				long[] result = null;
				if (m_commandImpl != null)
				{
					result = m_commandImpl.m_rowsAffectedPerBind;
				}
				return result;
			}
		}

		[DefaultValue(false)]
		[Description("")]
		[Category("Behavior")]
		public bool BindByName
		{
			get
			{
				return m_bBindByName;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_bBindByName != value)
				{
					m_bBindByName = value;
					m_modified = true;
					if (m_commandImpl != null)
					{
						m_commandImpl.m_bBindByName = m_bBindByName;
					}
				}
			}
		}

		[Category("Behavior")]
		[DefaultValue(false)]
		[Description("")]
		public bool UseEdmMapping
		{
			get
			{
				return m_isFromEF;
			}
			set
			{
				m_isFromEF = value;
			}
		}

		[DefaultValue("")]
		[Category("Data")]
		[Description("")]
		public override string CommandText
		{
			get
			{
				if (m_commandText != null)
				{
					return m_commandText;
				}
				return string.Empty;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_commandText != value)
				{
					m_commandText = value;
					m_cmdTxtModified = true;
				}
			}
		}

		[DefaultValue(0)]
		[Browsable(false)]
		public override int CommandTimeout
		{
			get
			{
				return m_commandTimeout;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (value < 0 || value > int.MaxValue)
				{
					throw new ArgumentException();
				}
				m_commandTimeout = value;
			}
		}

		[Category("Data")]
		[DefaultValue(CommandType.Text)]
		[Description("")]
		public override CommandType CommandType
		{
			get
			{
				return m_commandType;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_commandType != value)
				{
					if (value != CommandType.Text && value != CommandType.StoredProcedure && value != CommandType.TableDirect)
					{
						throw new ArgumentException();
					}
					m_commandType = value;
					m_cmdTxtModified = true;
				}
			}
		}

		[Category("Data")]
		[DefaultValue(null)]
		[Description("")]
		public OracleRefCursor[] ImplicitRefCursors
		{
			get
			{
				if (m_commandImpl.m_implicitRSList != null)
				{
					m_implicitRefCursors = new OracleRefCursor[m_commandImpl.m_implicitRSList.Count];
					for (int i = 0; i < m_commandImpl.m_implicitRSList.Count; i++)
					{
						OracleRefCursorImpl refCursorImpl = new OracleRefCursorImpl(m_commandImpl.m_implicitRSList[i]);
						OracleRefCursor oracleRefCursor = new OracleRefCursor(m_connection, refCursorImpl, m_commandImpl.m_sessionTimeZone, m_commandText, i.ToString(), m_initialLongFS, m_clientInitialLOBFS, 33554432L, 0L, null, bImplicitRefCursor: true);
						m_implicitRefCursors[i] = oracleRefCursor;
					}
					m_commandImpl.m_implicitRSList = null;
				}
				return m_implicitRefCursors;
			}
		}

		[Category("Data")]
		[Description("")]
		[DefaultValue(OracleXmlCommandType.None)]
		public OracleXmlCommandType XmlCommandType
		{
			get
			{
				return m_xmlCommandType;
			}
			set
			{
				if (m_xmlCommandType != value)
				{
					m_xmlCommandType = value;
					m_modified = true;
				}
			}
		}

		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public OracleXmlQueryProperties XmlQueryProperties
		{
			get
			{
				if (m_xmlQueryProperties == null)
				{
					m_xmlQueryProperties = new OracleXmlQueryProperties();
				}
				return m_xmlQueryProperties;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException();
				}
				m_xmlQueryProperties = (OracleXmlQueryProperties)value.Clone();
			}
		}

		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public OracleXmlSaveProperties XmlSaveProperties
		{
			get
			{
				if (m_xmlSaveProperties == null)
				{
					m_xmlSaveProperties = new OracleXmlSaveProperties();
				}
				return m_xmlSaveProperties;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException();
				}
				m_xmlSaveProperties = (OracleXmlSaveProperties)value.Clone();
			}
		}

		[Description("")]
		[Category("Behavior")]
		[DefaultValue(null)]
		public new OracleConnection Connection
		{
			get
			{
				return m_connection;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_connection != value)
				{
					m_implicitRefCursors = null;
					if (m_commandImpl != null && m_commandImpl.m_implicitRSList != null && m_connection != null && m_connection.m_oracleConnectionImpl != null)
					{
						for (int i = 0; i < m_commandImpl.m_implicitRSList.Count; i++)
						{
							m_connection.m_oracleConnectionImpl.AddCursorIdToBeClosed(m_commandImpl.m_implicitRSList[i].CursorId);
						}
						m_commandImpl.m_implicitRSList = null;
					}
					if (m_connection != null && m_connection.m_oracleConnectionImpl != null && m_commandImpl != null && m_commandImpl.m_bPooled)
					{
						m_connection.m_oracleConnectionImpl.m_preferredCommandImplTaken = false;
					}
					m_commandImpl = null;
				}
				m_connection = value;
				if (m_commandImpl == null)
				{
					m_commandImpl = GetInitializedCommandImpl();
				}
			}
		}

		protected override DbConnection DbConnection
		{
			get
			{
				return m_connection;
			}
			set
			{
				Connection = (OracleConnection)value;
			}
		}

		protected override DbTransaction DbTransaction
		{
			get
			{
				if (m_connection == null || m_connection.m_oraTransaction == null)
				{
					return null;
				}
				return m_connection.m_oraTransaction;
			}
			set
			{
			}
		}

		[Browsable(false)]
		public new OracleTransaction Transaction
		{
			get
			{
				if (OracleConnection.IsAvailable)
				{
					return null;
				}
				if (m_connection == null)
				{
					return null;
				}
				if (m_connection.m_oraTransaction == null)
				{
					return null;
				}
				return m_connection.m_oraTransaction;
			}
			set
			{
			}
		}

		[DefaultValue(true)]
		[Browsable(false)]
		[DesignOnly(true)]
		public override bool DesignTimeVisible
		{
			get
			{
				return m_designTimeVisible;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				m_designTimeVisible = value;
			}
		}

		[DefaultValue(131072L)]
		[Description("")]
		public long FetchSize
		{
			get
			{
				return m_fetchSize;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_fetchSize != value)
				{
					if (value <= 0)
					{
						throw new ArgumentException();
					}
					m_fetchSize = value;
					if (m_commandImpl != null)
					{
						m_commandImpl.m_fetchSize = m_fetchSize;
					}
				}
			}
		}

		[DefaultValue(0)]
		[Browsable(false)]
		public long RowSize
		{
			get
			{
				long result = 0L;
				if (m_commandImpl != null && m_commandImpl.m_sqlMetaData != null)
				{
					result = m_commandImpl.m_sqlMetaData.m_maxRowSize + m_commandImpl.m_sqlMetaData.m_numOfLOBColumns * Math.Max(86, 86 + m_clientInitialLOBFS) + m_commandImpl.m_sqlMetaData.m_numOfJSONColumns * Math.Max(86, 86) + m_commandImpl.m_sqlMetaData.m_numOfLONGColumns * Math.Max(2, m_initialLongFS) + m_commandImpl.m_sqlMetaData.m_numOfBFileColumns * 86;
				}
				return result;
			}
		}

		[DefaultValue(0)]
		[Description("")]
		public int InitialLOBFetchSize
		{
			get
			{
				return m_clientInitialLOBFS;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_clientInitialLOBFS != value)
				{
					if (value < -1)
					{
						throw new ArgumentException();
					}
					m_clientInitialLOBFS = value;
					m_modified = true;
				}
			}
		}

		[DefaultValue(0)]
		[Description("")]
		public int InitialLONGFetchSize
		{
			get
			{
				return m_initialLongFS;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_initialLongFS != value)
				{
					if (value < -1)
					{
						throw new ArgumentException();
					}
					m_initialLongFS = value;
					m_modified = true;
				}
			}
		}

		public override UpdateRowSource UpdatedRowSource
		{
			get
			{
				return m_updatedRowSource;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				if (m_updatedRowSource != value)
				{
					if (value != UpdateRowSource.Both && value != UpdateRowSource.FirstReturnedRecord && value != 0 && value != UpdateRowSource.OutputParameters)
					{
						throw new ArgumentException();
					}
					m_updatedRowSource = value;
					m_modified = true;
				}
			}
		}

		protected override DbParameterCollection DbParameterCollection
		{
			get
			{
				if (m_parameters == null)
				{
					m_parameters = new OracleParameterCollection();
				}
				return m_parameters;
			}
		}

		[Description("")]
		[Category("Data")]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
		public new OracleParameterCollection Parameters
		{
			get
			{
				if (m_parameters == null)
				{
					m_parameters = new OracleParameterCollection();
				}
				return m_parameters;
			}
		}

		[DefaultValue(null)]
		[Browsable(false)]
		public OracleNotificationRequest Notification
		{
			get
			{
				return m_NTFNReq;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				m_NTFNReq = value;
			}
		}

		[Browsable(false)]
		[DefaultValue(true)]
		public bool NotificationAutoEnlist
		{
			get
			{
				return m_NTFNAutoEnlist;
			}
			set
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				m_NTFNAutoEnlist = value;
			}
		}

		public OracleCommand()
		{
			m_commandTimeout = ConfigBaseClass.m_commandTimeout;
		}

		public OracleCommand(string cmdText)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ctor);
			}
			m_commandTimeout = ConfigBaseClass.m_commandTimeout;
			m_commandText = cmdText;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ctor);
			}
		}

		public OracleCommand(string cmdText, OracleConnection conn)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ctor);
			}
			m_commandTimeout = ConfigBaseClass.m_commandTimeout;
			m_commandText = cmdText;
			m_connection = conn;
			m_commandImpl = GetInitializedCommandImpl();
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ctor);
			}
		}

		public override void Cancel()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Cancel);
			}
			try
			{
				ValidateStatePriorToExecution();
				if (m_bExecuteInProgress)
				{
					m_commandImpl.Cancel(m_connection.m_oracleConnectionImpl, m_commandImpl.m_executionId);
				}
				else if (m_lastReaderWeakRef != null && m_lastReaderWeakRef.IsAlive && ((OracleDataReader)m_lastReaderWeakRef.Target).m_readerImpl != null)
				{
					((OracleDataReader)m_lastReaderWeakRef.Target).m_readerImpl.Cancel();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Cancel, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Cancel);
				}
			}
		}

		public object Clone()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Clone);
			}
			OracleCommand oracleCommand = null;
			try
			{
				oracleCommand = new OracleCommand();
				oracleCommand.m_connection = m_connection;
				oracleCommand.m_updatedRowSource = m_updatedRowSource;
				oracleCommand.m_commandText = m_commandText;
				oracleCommand.m_pooledCmdText = m_pooledCmdText;
				oracleCommand.m_addRowId = m_addRowId;
				oracleCommand.m_addToStatementCache = m_addToStatementCache;
				oracleCommand.m_arrayBindCount = m_arrayBindCount;
				oracleCommand.m_bBindByName = m_bBindByName;
				oracleCommand.m_fetchSize = m_fetchSize;
				oracleCommand.m_commandImpl = new OracleCommandImpl();
				if (m_commandImpl != null)
				{
					oracleCommand.m_commandImpl.Copy(m_commandImpl);
				}
				oracleCommand.m_commandType = m_commandType;
				oracleCommand.m_rowsAffected = m_rowsAffected;
				oracleCommand.m_initialLongFS = m_initialLongFS;
				oracleCommand.m_clientInitialLOBFS = m_clientInitialLOBFS;
				oracleCommand.m_modified = m_modified;
				oracleCommand.m_cmdTxtModified = m_cmdTxtModified;
				oracleCommand.CommandTimeout = m_commandTimeout;
				oracleCommand.m_designTimeVisible = m_designTimeVisible;
				oracleCommand.m_isFromEF = m_isFromEF;
				oracleCommand.m_expectedColumnTypes = m_expectedColumnTypes;
				if (m_parameters != null)
				{
					oracleCommand.m_parameters = new OracleParameterCollection();
					foreach (OracleParameter parameter in m_parameters)
					{
						oracleCommand.m_parameters.Add(parameter.Clone());
					}
				}
				oracleCommand.m_cachedReader = m_cachedReader;
				return oracleCommand;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Clone, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Clone);
				}
			}
		}

		protected override DbParameter CreateDbParameter()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CreateDbParameter);
			}
			try
			{
				return new OracleParameter();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CreateDbParameter, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CreateDbParameter);
				}
			}
		}

		protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteDbDataReader);
			}
			try
			{
				OracleDataReader oracleDataReader = ExecuteReader(requery: true, fillRequest: false, behavior);
				oracleDataReader.m_returnPSTypes = m_returnPSTypes;
				return oracleDataReader;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteDbDataReader, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteDbDataReader);
				}
			}
		}

		public new OracleParameter CreateParameter()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CreateParameter);
			}
			try
			{
				if (m_disposed)
				{
					throw new ObjectDisposedException(GetType().Name);
				}
				return new OracleParameter();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CreateParameter, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CreateParameter);
				}
			}
		}

		protected override void Dispose(bool disposing)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Dispose);
			}
			try
			{
				if (m_disposed)
				{
					return;
				}
				try
				{
					if (m_commandImpl != null && m_commandImpl.m_implicitRSList != null && m_connection != null && m_connection.m_oracleConnectionImpl != null)
					{
						m_commandImpl.CloseImplicitRefCursors(m_connection.m_oracleConnectionImpl);
					}
					if (disposing)
					{
						try
						{
							if (m_cachedReader != null && !m_cachedReader.IsClosed)
							{
								try
								{
									m_cachedReader.Close();
								}
								catch
								{
								}
							}
							m_cachedReader = null;
						}
						catch
						{
						}
					}
					if (m_commandImpl != null && m_commandImpl.m_bPooled && m_connection != null && m_connection.m_oracleConnectionImpl != null)
					{
						m_connection.m_oracleConnectionImpl.m_preferredCommandImplTaken = false;
					}
				}
				catch
				{
				}
				finally
				{
					m_modified = true;
					m_disposed = true;
					m_commandImpl = null;
					try
					{
						base.Dispose(disposing);
					}
					catch
					{
					}
					GC.SuppressFinalize(this);
				}
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.Dispose);
				}
			}
		}

		private void BuildCommandText()
		{
			StringBuilder stringBuilder = new StringBuilder();
			OracleParameter oracleParameter = null;
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.BuildCommandText);
			}
			try
			{
				if (m_cmdTxtModified)
				{
					ConfigBaseClass.StoredProcedureInfo storedProcInfo = ConfigBaseClass.GetInstance(bIsManaged: true).GetStoredProcInfo(m_commandText.Trim());
					if (storedProcInfo != null && storedProcInfo.m_refCursors.Count > 0)
					{
						for (int i = 0; i < storedProcInfo.m_refCursors.Count; i++)
						{
							AddRefCursorParamToParamColl(storedProcInfo.m_refCursors[i]);
						}
					}
				}
				if (m_parameters == null || m_parameters.Count == 0)
				{
					stringBuilder.Append("Begin " + m_commandText + "(); End;");
					m_pooledCmdText = stringBuilder.ToString();
					return;
				}
				int count = Parameters.Count;
				int j;
				if (!m_commandImpl.m_bBindByName)
				{
					if ((oracleParameter = GetReturnValueParam()) == null)
					{
						stringBuilder.Append("Begin " + m_commandText + "(:v0");
						for (j = 1; j < count; j++)
						{
							stringBuilder.Append(", :v" + j);
						}
						stringBuilder.Append("); End;");
						m_pooledCmdText = stringBuilder.ToString();
						return;
					}
					if (m_parameters[0] == oracleParameter)
					{
						if (count > 1)
						{
							stringBuilder.Append("Begin :ret := " + m_commandText + "(:v1");
							j = 2;
						}
						else
						{
							stringBuilder.Append("Begin :ret := " + m_commandText + "(");
							j = 1;
						}
					}
					else
					{
						stringBuilder.Append("Begin :ret := " + m_commandText + "(:v0");
						j = 1;
					}
					for (; j < count; j++)
					{
						if (m_parameters[j] != oracleParameter)
						{
							stringBuilder.Append(", :v" + j);
						}
					}
					stringBuilder.Append("); End;");
					m_pooledCmdText = stringBuilder.ToString();
					return;
				}
				if ((oracleParameter = GetReturnValueParam()) == null)
				{
					stringBuilder.Append("Begin " + m_commandText + "(" + m_parameters[0].ParameterName + "=>:v0");
					for (j = 1; j < count; j++)
					{
						stringBuilder.Append(", " + m_parameters[j].ParameterName + "=>:v" + j);
					}
					stringBuilder.Append("); End;");
					m_pooledCmdText = stringBuilder.ToString();
					return;
				}
				if (m_parameters[0] == oracleParameter)
				{
					if (count > 1)
					{
						stringBuilder.Append("Begin :ret := " + m_commandText + "(" + m_parameters[1].ParameterName + "=>:v1");
						j = 2;
					}
					else
					{
						stringBuilder.Append("Begin :ret := " + m_commandText + "(");
						j = 1;
					}
				}
				else
				{
					stringBuilder.Append("Begin :ret := " + m_commandText + "(" + m_parameters[0].ParameterName + "=>:v0");
					j = 1;
				}
				for (; j < count; j++)
				{
					if (m_parameters[j] != oracleParameter)
					{
						stringBuilder.Append(", " + m_parameters[j].ParameterName + "=>:v" + j);
					}
				}
				stringBuilder.Append("); End;");
				m_pooledCmdText = stringBuilder.ToString();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.BuildCommandText, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.BuildCommandText);
				}
			}
		}

		private OracleParameter GetReturnValueParam()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.GetReturnValueParam);
			}
			try
			{
				if (m_commandType != CommandType.StoredProcedure)
				{
					return null;
				}
				int count = m_parameters.Count;
				for (int i = 0; i < count; i++)
				{
					if (m_parameters[i].Direction == ParameterDirection.ReturnValue)
					{
						return m_parameters[i];
					}
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.GetReturnValueParam, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.GetReturnValueParam);
				}
			}
			return null;
		}

		private void DoPreExecuteProcessing(OracleDependencyImpl orclDependencyImpl, bool bXmlQuerySave = false)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.DoPreExecuteProcessing);
			}
			try
			{
				if (m_connection == null)
				{
					throw new InvalidOperationException();
				}
				if (ConnectionState.Open != m_connection.m_connectionState)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				if (m_cmdTxtModified && (m_commandText == null || m_commandText.Length == 0))
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.ODP_INVALID_VALUE, "OracleCommand.CommandText"));
				}
				bool flag = orclDependencyImpl != null && !orclDependencyImpl.m_bIsRegistered;
				if (!bXmlQuerySave && (m_cmdTxtModified || m_commandType == CommandType.StoredProcedure))
				{
					if (m_commandType == CommandType.Text)
					{
						m_pooledCmdText = m_commandText;
					}
					else if (m_commandType == CommandType.TableDirect)
					{
						m_pooledCmdText = "Select * from " + m_commandText;
					}
					else if (m_commandType == CommandType.StoredProcedure)
					{
						BuildCommandText();
					}
					m_commandImpl.m_addRowidDoneImplicitly = (m_commandImpl.m_foundExplicitRowidInSql = false);
					if (m_commandImpl.m_addRowid || flag)
					{
						m_commandImpl.m_addRowidDoneImplicitly = SQLParser.DoSqlLocalProcessing(ref m_pooledCmdText, m_commandImpl.m_addRowid, out m_commandImpl.m_foundExplicitRowidInSql, m_connection.m_oracleConnectionImpl, m_connection);
					}
					m_cmdTxtModified = false;
				}
				if (flag)
				{
					bool flag2 = m_commandImpl.m_addRowid || m_commandImpl.m_foundExplicitRowidInSql || orclDependencyImpl.m_bIncludeRowId;
					OracleNotificationManager.RegisterForChangeNotification(m_connection.m_oracleConnectionImpl, orclDependencyImpl, flag2 && !orclDependencyImpl.m_bExcludeRowId);
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.DoPreExecuteProcessing, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.DoPreExecuteProcessing);
				}
			}
		}

		public override int ExecuteNonQuery()
		{
			int result = 0;
			OracleException exceptionForArrayBindDML = null;
			OracleLogicalTransaction oracleLogicalTransaction = null;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteNonQuery);
			}
			try
			{
				ValidateStatePriorToExecution();
				m_commandImpl.m_cancelExecutionEvent.Reset();
				m_commandImpl.m_continueCancel.Reset();
				m_commandImpl.m_bServerExecutionComplete = false;
				m_bExecuteInProgress = true;
				OracleParameterCollection bindByPositionParamColl = null;
				bool bBindParamPresent = true;
				Timer timer = null;
				long[] scnFromExecution;
				try
				{
					if (m_xmlCommandType != 0)
					{
						if (OracleXmlCommandType.Query == m_xmlCommandType)
						{
							ExecuteXmlQuery(wantResult: false);
							return -1;
						}
						return ExecuteXmlSave();
					}
					if (m_commandTimeout > 0)
					{
						timer = SetupCommandTimeoutCallback();
					}
					OracleDependencyImpl orclDependencyImpl = null;
					if (m_NTFNAutoEnlist && m_NTFNReq != null)
					{
						PopulateSubscriptionInfo(out orclDependencyImpl);
					}
					DoPreExecuteProcessing(orclDependencyImpl);
					result = m_commandImpl.ExecuteNonQuery(m_pooledCmdText, m_parameters, m_commandType, m_connection.m_oracleConnectionImpl, m_initialLongFS, m_clientInitialLOBFS, orclDependencyImpl, out scnFromExecution, out bindByPositionParamColl, ref bBindParamPresent, out exceptionForArrayBindDML, m_connection, ref oracleLogicalTransaction, m_isFromEF);
					m_connection.CheckForWarnings(this);
					if (orclDependencyImpl != null && !orclDependencyImpl.m_regList.Contains(m_commandText))
					{
						orclDependencyImpl.m_regList.Add(m_commandText);
					}
				}
				finally
				{
					m_bExecuteInProgress = false;
					if (timer != null)
					{
						timer.Change(-1L, -1L);
						timer.Dispose();
					}
				}
				m_cmdTxtModified = false;
				if (bBindParamPresent && m_parameters != null && m_parameters.Count > 0)
				{
					m_commandImpl.ExtractAccessorValuesIntoParam(bindByPositionParamColl, m_connection, bindByPositionParamColl.Count, m_commandText, m_initialLongFS, m_clientInitialLOBFS, 0L, 0L, scnFromExecution, bCallFromExecuteReader: false);
				}
				if (exceptionForArrayBindDML != null)
				{
					if (bindByPositionParamColl != null)
					{
						foreach (OracleParameter item in bindByPositionParamColl)
						{
							item.PreBindFree();
						}
					}
					throw exceptionForArrayBindDML;
				}
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteNonQuery, ex, oracleLogicalTransaction);
				if (ex is OracleException)
				{
					if (((OracleException)ex).OracleLogicalTransaction == null || ((OracleException)ex).OracleLogicalTransaction.UserCallCompleted != true || ((OracleException)ex).OracleLogicalTransaction.Committed != true)
					{
						throw;
					}
					return result;
				}
				throw;
			}
			finally
			{
				if (m_commandImpl != null)
				{
					m_commandImpl.m_bindAccessors = null;
				}
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteNonQuery);
				}
			}
		}

		internal SQLMetaData DoDescribeSelectQuery(out int hiddenColumnCount)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.DoDescribeSelectQuery);
			}
			try
			{
				hiddenColumnCount = 0;
				ValidateStatePriorToExecution();
				DoPreExecuteProcessing(null);
				SQLMetaData sqlMetadata = null;
				m_commandImpl.RetrieveMetadata(m_pooledCmdText, m_commandType, m_parameters, m_connection.m_oracleConnectionImpl, m_connection, out sqlMetadata, out hiddenColumnCount);
				return sqlMetadata;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.DoDescribeSelectQuery, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.DoDescribeSelectQuery);
				}
			}
		}

		public new OracleDataReader ExecuteReader()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader);
			}
			try
			{
				return ExecuteReader(requery: true, fillRequest: false, CommandBehavior.Default);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader);
				}
			}
		}

		public new OracleDataReader ExecuteReader(CommandBehavior behavior)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader);
			}
			try
			{
				return ExecuteReader(requery: true, fillRequest: false, behavior);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader);
				}
			}
		}

		internal OracleDataReader ExecuteReader(bool requery, bool fillRequest, CommandBehavior behavior)
		{
			OracleDataReader oracleDataReader = null;
			OracleException exceptionForArrayBindDML = null;
			OracleLogicalTransaction oracleLogicalTransaction = null;
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader);
			}
			try
			{
				if (m_isFromEF && m_connection.m_majorVersion < 12 && m_commandText.Contains(" APPLY "))
				{
					throw new Exception(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.ODP_NOT_SUPPORTED, "Oracle " + m_connection.ServerVersion.ToString(), "APPLY"));
				}
				OracleDataReaderImpl rdrImpl = null;
				int recordsAffected = 0;
				OracleParameterCollection bindByPositionParamColl = null;
				bool bBindParamPresent = true;
				long[] scnFromExecution = null;
				long internalInitialLOBFS = 0L;
				bool flag = true;
				bool? bIsDefineInSelect = false;
				string cmdText = m_commandText;
				Timer timer = null;
				IEnumerable<OracleLpStatement> adrianParsedStmt = null;
				bool flag2 = false;
				if (m_xmlCommandType != 0)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.ODP_NOT_SUPPORTED, "ExecuteReader", "XmlCommandType"));
				}
				try
				{
					if (!requery && m_cachedReader != null)
					{
						return m_cachedReader;
					}
					if (fillRequest && requery)
					{
						if (m_cachedReader != null)
						{
							if (!m_cachedReader.IsClosed)
							{
								m_cachedReader.Close();
							}
							m_cachedReader = null;
						}
						if (m_connection != null && m_connection.m_connectionState == ConnectionState.Closed)
						{
							m_connection.Open();
							behavior |= CommandBehavior.CloseConnection;
						}
					}
					ValidateStatePriorToExecution();
					m_commandImpl.m_cancelExecutionEvent.Reset();
					m_commandImpl.m_continueCancel.Reset();
					m_commandImpl.m_bServerExecutionComplete = false;
					m_bExecuteInProgress = true;
					if (m_commandTimeout > 0)
					{
						timer = SetupCommandTimeoutCallback();
					}
					OracleDependencyImpl orclDependencyImpl = null;
					if (m_NTFNAutoEnlist && m_NTFNReq != null)
					{
						PopulateSubscriptionInfo(out orclDependencyImpl);
					}
					DoPreExecuteProcessing(orclDependencyImpl);
					m_lastReaderWeakRef = null;
					if ((behavior & CommandBehavior.SchemaOnly) == CommandBehavior.SchemaOnly)
					{
						bool? gotSqlMetadata = null;
						SQLMetaData sqlMetaData = null;
						m_commandImpl.m_sqlStatementType = SqlStatementType.OTHERS;
						if (m_commandType == CommandType.StoredProcedure)
						{
							m_commandImpl.m_sqlStatementType = SqlStatementType.PLSQL;
						}
						else if (m_commandType == CommandType.TableDirect)
						{
							m_commandImpl.m_sqlStatementType = SqlStatementType.SELECT;
						}
						else
						{
							OracleCommandImpl.TrimCommentsFromSQL(ref cmdText);
							if (ConfigBaseClass.m_bUseLegacyLocalParser || flag2)
							{
								m_commandImpl.m_sqlStatementType = OracleCommandImpl.GetSqlStatementType(cmdText, ref bIsDefineInSelect);
							}
						}
						if (m_commandImpl.m_sqlStatementType == SqlStatementType.SELECT)
						{
							rdrImpl = m_commandImpl.GetReaderImplWithSchemaOnly(m_connection.m_oracleConnectionImpl, m_commandType, m_pooledCmdText, gotSqlMetadata, sqlMetaData);
							flag = false;
						}
					}
					if (flag)
					{
						recordsAffected = m_commandImpl.ExecuteReader(m_pooledCmdText, m_parameters, m_commandType, m_connection.m_oracleConnectionImpl, ref rdrImpl, m_initialLongFS, m_clientInitialLOBFS, orclDependencyImpl, null, out scnFromExecution, out bindByPositionParamColl, ref bBindParamPresent, ref internalInitialLOBFS, 33554432L, out exceptionForArrayBindDML, m_connection, ref oracleLogicalTransaction, adrianParsedStmt, (behavior & CommandBehavior.SchemaOnly) == CommandBehavior.SchemaOnly, m_isFromEF);
					}
					m_connection.CheckForWarnings(this);
					if (orclDependencyImpl != null && !orclDependencyImpl.m_regList.Contains(m_commandText))
					{
						orclDependencyImpl.m_regList.Add(m_commandText);
					}
				}
				finally
				{
					m_bExecuteInProgress = false;
					if (timer != null)
					{
						timer.Change(-1L, -1L);
						timer.Dispose();
					}
				}
				m_cmdTxtModified = false;
				if (flag)
				{
					if (bBindParamPresent && m_parameters != null && m_parameters.Count > 0)
					{
						m_commandImpl.ExtractAccessorValuesIntoParam(bindByPositionParamColl, m_connection, bindByPositionParamColl.Count, m_commandText, m_initialLongFS, m_clientInitialLOBFS, internalInitialLOBFS, 33554432L, scnFromExecution, bCallFromExecuteReader: true);
					}
					if (exceptionForArrayBindDML != null)
					{
						if (bindByPositionParamColl != null)
						{
							foreach (OracleParameter item3 in bindByPositionParamColl)
							{
								item3.PreBindFree();
							}
						}
						throw exceptionForArrayBindDML;
					}
				}
				if (rdrImpl != null)
				{
					oracleDataReader = new OracleDataReader(rdrImpl, m_connection, m_commandImpl.m_fetchSize, m_clientInitialLOBFS, internalInitialLOBFS, 33554432L, m_initialLongFS, recordsAffected, m_pooledCmdText, m_commandImpl.m_sqlStatementType, behavior);
				}
				else
				{
					List<OracleRefCursor> list = null;
					int num = 0;
					int num2 = 0;
					if (bBindParamPresent && m_parameters != null && m_parameters.Count > 0)
					{
						list = new List<OracleRefCursor>();
						foreach (OracleParameter parameter in m_parameters)
						{
							if (parameter.Direction == ParameterDirection.Input || parameter.OracleDbType != OracleDbType.RefCursor)
							{
								continue;
							}
							OracleRefCursor item = null;
							if (parameter.Value == null)
							{
								continue;
							}
							if (m_arrayBindCount > 0)
							{
								OracleRefCursor[] array = parameter.Value as OracleRefCursor[];
								for (int i = 0; i < array.Length; i++)
								{
									if (OracleRefCursor.Null != array[i] && array[i] != null)
									{
										item = array[i];
									}
									list.Add(item);
									num++;
									num2++;
								}
							}
							else
							{
								if (parameter.Value != DBNull.Value && parameter.Value != OracleRefCursor.Null)
								{
									item = parameter.Value as OracleRefCursor;
								}
								list.Add(item);
								parameter.Value = DBNull.Value;
								num++;
								num2++;
							}
							parameter.Value = DBNull.Value;
						}
					}
					if (m_commandImpl.m_implicitRSList != null && m_commandImpl.m_implicitRSList.Count > 0)
					{
						if (list == null)
						{
							list = new List<OracleRefCursor>();
						}
						for (int j = 0; j < m_commandImpl.m_implicitRSList.Count; j++)
						{
							OracleRefCursorImpl refCursorImpl = new OracleRefCursorImpl(m_commandImpl.m_implicitRSList[j]);
							OracleRefCursor item2 = new OracleRefCursor(m_connection, refCursorImpl, m_commandImpl.m_sessionTimeZone, "", num.ToString(), m_initialLongFS, m_clientInitialLOBFS, 33554432L, 0L, scnFromExecution, bImplicitRefCursor: true);
							list.Add(item2);
							num++;
						}
						m_commandImpl.m_implicitRSList = null;
					}
					if (list != null && list.Count > 0)
					{
						rdrImpl = m_connection.m_oracleConnectionImpl.GetInitializedDataReaderImpl(list, m_initialLongFS, scnFromExecution);
						oracleDataReader = new OracleDataReader(rdrImpl, m_connection, m_commandImpl.m_fetchSize, m_clientInitialLOBFS, internalInitialLOBFS, 33554432L, m_initialLongFS, recordsAffected, string.Empty, SqlStatementType.PLSQL, behavior);
						if (m_commandType == CommandType.StoredProcedure)
						{
							oracleDataReader.m_storedProcName = m_commandText;
						}
						oracleDataReader.m_numExplicitBoundRefCursors = num2;
						if (m_isFromEF)
						{
							oracleDataReader.m_isFromEF = m_isFromEF;
							if (m_expectedColumnTypes != null)
							{
								oracleDataReader.m_expectedColumnTypes = m_expectedColumnTypes;
							}
							else
							{
								oracleDataReader.GetEdmMappingConfigValues();
								oracleDataReader.PopulateExpectedTypes();
							}
						}
						return oracleDataReader;
					}
					if (oracleDataReader == null)
					{
						oracleDataReader = new OracleDataReader(null, m_connection, m_commandImpl.m_fetchSize, m_clientInitialLOBFS, internalInitialLOBFS, 33554432L, m_initialLongFS, recordsAffected, m_pooledCmdText, m_commandImpl.m_sqlStatementType, behavior);
					}
				}
				if (m_isFromEF)
				{
					oracleDataReader.m_isFromEF = m_isFromEF;
					if (m_expectedColumnTypes != null)
					{
						oracleDataReader.m_expectedColumnTypes = m_expectedColumnTypes;
					}
					else
					{
						oracleDataReader.GetEdmMappingConfigValues();
						oracleDataReader.PopulateExpectedTypes();
					}
				}
				if (!requery)
				{
					m_cachedReader = oracleDataReader;
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader, ex, oracleLogicalTransaction);
				if (!(ex is OracleException))
				{
					throw;
				}
				if (((OracleException)ex).OracleLogicalTransaction == null || ((OracleException)ex).OracleLogicalTransaction.UserCallCompleted != true || ((OracleException)ex).OracleLogicalTransaction.Committed != true)
				{
					throw;
				}
			}
			finally
			{
				if (m_commandImpl != null)
				{
					m_commandImpl.m_bindAccessors = null;
				}
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteReader);
				}
			}
			m_lastReaderWeakRef = new WeakReference(oracleDataReader);
			return oracleDataReader;
		}

		public override object ExecuteScalar()
		{
			object result = null;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteScalar);
			}
			try
			{
				ValidateStatePriorToExecution();
				long fetchSize = m_commandImpl.m_fetchSize;
				m_commandImpl.m_fetchSize = 1L;
				m_pooledCmdText = m_commandText;
				OracleDataReader oracleDataReader = ExecuteReader();
				m_commandImpl.m_fetchSize = fetchSize;
				if (oracleDataReader.Read())
				{
					result = (oracleDataReader.IsDBNull(0) ? DBNull.Value : oracleDataReader.GetValue(0));
				}
				oracleDataReader.Close();
				oracleDataReader.Dispose();
				oracleDataReader = null;
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteScalar, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteScalar);
				}
			}
		}

		public Stream ExecuteStream()
		{
			Stream stream = null;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteStream);
			}
			if (m_connection == null)
			{
				throw new InvalidOperationException();
			}
			if (m_cmdTxtModified && (m_commandText == null || m_commandText.Length == 0))
			{
				throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.ODP_INVALID_VALUE, "OracleCommand.CommandText"));
			}
			if (m_xmlCommandType == OracleXmlCommandType.None)
			{
				throw new InvalidOperationException();
			}
			try
			{
				if (OracleXmlCommandType.Query == m_xmlCommandType)
				{
					return ExecuteXmlQuery(wantResult: true);
				}
				ExecuteXmlSave();
				return new OracleClob(m_connection);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteStream, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteStream);
				}
			}
		}

		public void ExecuteToStream(Stream outputStream)
		{
			int num = 0;
			int num2 = 0;
			byte[] array = null;
			long num3 = 0L;
			int num4 = 0;
			int num5 = 0;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteToStream);
			}
			if (m_connection == null)
			{
				throw new InvalidOperationException();
			}
			if (m_cmdTxtModified && (m_commandText == null || m_commandText.Length == 0))
			{
				throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.ODP_INVALID_VALUE, "OracleCommand.CommandText"));
			}
			if (m_xmlCommandType == OracleXmlCommandType.None)
			{
				throw new InvalidOperationException();
			}
			if (outputStream == null)
			{
				throw new ArgumentNullException();
			}
			if (!outputStream.CanWrite)
			{
				throw new ArgumentException();
			}
			try
			{
				if (OracleXmlCommandType.Query == m_xmlCommandType)
				{
					OracleClob oracleClob = ExecuteXmlQuery(wantResult: true);
					num3 = oracleClob.Length;
					if (outputStream.GetType().FullName!.Equals("(Oracle.ManagedDataAccess.Types.OracleClob") && num3 % 2 == 0L)
					{
						OracleClob oracleClob2 = (OracleClob)outputStream;
						oracleClob.CopyTo(oracleClob2, oracleClob2.Position / 2);
					}
					else
					{
						if (num3 < 65536)
						{
							num2 = (int)num3;
						}
						else
						{
							num = 2 * oracleClob.OptimumChunkSize;
							num2 = num * (65536 / num);
							if (num2 == 0)
							{
								num2 = num;
							}
						}
						array = new byte[num2];
						while (num3 > 0)
						{
							if (num3 < num2)
							{
								num4 = (int)num3;
								num3 = 0L;
							}
							else
							{
								num4 = num2;
								num3 -= num2;
							}
							num5 = oracleClob.Read(array, 0, num4);
							if (num5 != num4)
							{
								throw new IOException();
							}
							outputStream.Write(array, 0, num5);
						}
					}
					oracleClob.Close();
				}
				else
				{
					ExecuteXmlSave();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteToStream, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteToStream);
				}
			}
		}

		public XmlReader ExecuteXmlReader()
		{
			XmlReader xmlReader = null;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlReader);
			}
			if (m_connection == null)
			{
				throw new InvalidOperationException();
			}
			if (m_cmdTxtModified && (m_commandText == null || m_commandText.Length == 0))
			{
				throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.ODP_INVALID_VALUE, "OracleCommand.CommandText"));
			}
			if (m_xmlCommandType == OracleXmlCommandType.None)
			{
				throw new InvalidOperationException();
			}
			try
			{
				if (OracleXmlCommandType.Query == m_xmlCommandType)
				{
					OracleClob oracleClob = ExecuteXmlQuery(wantResult: true);
					long length = oracleClob.Length;
					int num = 65536;
					if (length < 65536)
					{
						num = (int)length;
					}
					return new XmlTextReader(new StreamReader(bufferSize: num / 2, stream: oracleClob, encoding: Encoding.Unicode, detectEncodingFromByteOrderMarks: false));
				}
				ExecuteXmlSave();
				return new XmlTextReader(new StringReader(string.Empty));
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlReader, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlReader);
				}
			}
		}

		private OracleClob ExecuteXmlQuery(bool wantResult)
		{
			OracleException exceptionForArrayBindDML = null;
			OracleLogicalTransaction oracleLogicalTransaction = null;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlQuery);
			}
			try
			{
				ValidateStatePriorToExecution();
				m_commandImpl.m_cancelExecutionEvent.Reset();
				m_commandImpl.m_continueCancel.Reset();
				m_commandImpl.m_bServerExecutionComplete = false;
				m_bExecuteInProgress = true;
				OracleParameterCollection bindByPositionParamColl = null;
				bool bBindParamPresent = true;
				bool isOracle8i = false;
				bool transform = false;
				int numberOfUserParameters = 0;
				Timer timer = null;
				long[] scnFromExecution;
				try
				{
					m_bExecuteInProgress = true;
					if (m_commandTimeout > 0)
					{
						timer = SetupCommandTimeoutCallback();
					}
					OracleDependencyImpl orclDependencyImpl = null;
					if (m_NTFNAutoEnlist && m_NTFNReq != null)
					{
						PopulateSubscriptionInfo(out orclDependencyImpl);
					}
					DoPreExecuteProcessing(orclDependencyImpl, bXmlQuerySave: true);
					m_pooledCmdText = m_commandText;
					int majorVersion = m_connection.m_majorVersion;
					int minorVersion = m_connection.m_minorVersion;
					if ((majorVersion == 8 && minorVersion == 1) || (majorVersion == 9 && minorVersion == 0))
					{
						isOracle8i = true;
					}
					m_commandImpl.ExecuteXmlQuery(m_pooledCmdText, m_parameters, m_commandType, m_xmlCommandType, m_connection.m_oracleConnectionImpl, m_initialLongFS, m_clientInitialLOBFS, orclDependencyImpl, m_connection, out scnFromExecution, out bindByPositionParamColl, ref bBindParamPresent, ref m_xmlQueryProperties, out exceptionForArrayBindDML, out transform, out numberOfUserParameters, ref oracleLogicalTransaction, isFromEF: false, isOracle8i, wantResult);
					m_connection.CheckForWarnings(this);
					if (orclDependencyImpl != null && !orclDependencyImpl.m_regList.Contains(m_commandText))
					{
						orclDependencyImpl.m_regList.Add(m_commandText);
					}
				}
				finally
				{
					m_bExecuteInProgress = false;
					if (timer != null)
					{
						timer.Change(-1L, -1L);
						timer.Dispose();
					}
				}
				m_cmdTxtModified = false;
				if (bBindParamPresent && m_parameters != null && m_parameters.Count > 0)
				{
					m_commandImpl.ExtractAccessorValuesIntoParam(bindByPositionParamColl, m_connection, numberOfUserParameters, m_commandText, m_initialLongFS, m_clientInitialLOBFS, 0L, 0L, scnFromExecution, bCallFromExecuteReader: false);
				}
				if (exceptionForArrayBindDML != null)
				{
					if (bindByPositionParamColl != null)
					{
						foreach (OracleParameter item in bindByPositionParamColl)
						{
							item.PreBindFree();
						}
					}
					throw exceptionForArrayBindDML;
				}
				return m_commandImpl.ExtractXMLValuesIntoParam(ref bindByPositionParamColl, m_connection, numberOfUserParameters, wantResult, transform, isOracle8i, m_xmlQueryProperties);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlQuery, ex, oracleLogicalTransaction);
				if (ex is OracleException)
				{
					if (((OracleException)ex).OracleLogicalTransaction == null || ((OracleException)ex).OracleLogicalTransaction.UserCallCompleted != true || ((OracleException)ex).OracleLogicalTransaction.Committed != true)
					{
						throw;
					}
					return null;
				}
				throw;
			}
			finally
			{
				if (m_commandImpl != null)
				{
					m_commandImpl.m_bindAccessors = null;
				}
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlQuery);
				}
			}
		}

		private int ExecuteXmlSave()
		{
			int result = 0;
			OracleException exceptionForArrayBindDML = null;
			OracleLogicalTransaction oracleLogicalTransaction = null;
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlSave);
			}
			try
			{
				ValidateStatePriorToExecution();
				m_commandImpl.m_cancelExecutionEvent.Reset();
				m_commandImpl.m_continueCancel.Reset();
				m_commandImpl.m_bServerExecutionComplete = false;
				m_bExecuteInProgress = true;
				OracleParameterCollection bindByPositionParamColl = null;
				bool bBindParamPresent = true;
				Timer timer = null;
				long[] scnFromExecution;
				bool transform;
				try
				{
					if (m_commandTimeout > 0)
					{
						timer = SetupCommandTimeoutCallback();
					}
					OracleDependencyImpl orclDependencyImpl = null;
					if (m_NTFNAutoEnlist && m_NTFNReq != null)
					{
						PopulateSubscriptionInfo(out orclDependencyImpl);
					}
					DoPreExecuteProcessing(orclDependencyImpl, bXmlQuerySave: true);
					m_pooledCmdText = m_commandText;
					result = m_commandImpl.ExecuteXmlSave(m_pooledCmdText, m_parameters, m_commandType, m_xmlCommandType, m_connection.m_oracleConnectionImpl, m_initialLongFS, m_clientInitialLOBFS, orclDependencyImpl, m_connection, out scnFromExecution, out bindByPositionParamColl, ref bBindParamPresent, ref m_xmlSaveProperties, out exceptionForArrayBindDML, out transform, ref oracleLogicalTransaction, m_isFromEF);
					m_connection.CheckForWarnings(this);
					if (orclDependencyImpl != null && !orclDependencyImpl.m_regList.Contains(m_commandText))
					{
						orclDependencyImpl.m_regList.Add(m_commandText);
					}
				}
				finally
				{
					m_bExecuteInProgress = false;
					if (timer != null)
					{
						timer.Change(-1L, -1L);
						timer.Dispose();
					}
				}
				m_cmdTxtModified = false;
				if (bBindParamPresent && m_parameters != null && m_parameters.Count > 0)
				{
					m_commandImpl.ExtractAccessorValuesIntoParam(bindByPositionParamColl, m_connection, bindByPositionParamColl.Count, m_commandText, m_initialLongFS, m_clientInitialLOBFS, 0L, 0L, scnFromExecution, bCallFromExecuteReader: false);
				}
				if (exceptionForArrayBindDML != null)
				{
					if (bindByPositionParamColl != null)
					{
						foreach (OracleParameter item in bindByPositionParamColl)
						{
							item.PreBindFree();
						}
					}
					throw exceptionForArrayBindDML;
				}
				result = m_commandImpl.ExtractXMLSaveValuesIntoParam(ref bindByPositionParamColl, transform);
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlSave, ex, oracleLogicalTransaction);
				if (ex is OracleException)
				{
					if (((OracleException)ex).OracleLogicalTransaction == null || ((OracleException)ex).OracleLogicalTransaction.UserCallCompleted != true || ((OracleException)ex).OracleLogicalTransaction.Committed != true)
					{
						throw;
					}
					return result;
				}
				throw;
			}
			finally
			{
				if (m_commandImpl != null)
				{
					m_commandImpl.m_bindAccessors = null;
				}
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.ExecuteXmlSave);
				}
			}
		}

		public override void Prepare()
		{
		}

		private Timer SetupCommandTimeoutCallback()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.SetupCommandTimeoutCallback);
			}
			try
			{
				TimerCallback callback = CommandTimeoutCallback;
				long num = (long)m_commandTimeout * 1000L;
				if (num > 4147200000u)
				{
					num = 4147200000L;
				}
				return new Timer(callback, m_commandImpl.m_executionId, num, -1L);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.SetupCommandTimeoutCallback, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.SetupCommandTimeoutCallback);
				}
			}
		}

		private void CommandTimeoutCallback(object state)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CommandTimeoutCallback);
			}
			try
			{
				long num = (long)state;
				if (m_commandImpl.m_executionId == num)
				{
					ValidateStatePriorToExecution();
					if (m_bExecuteInProgress)
					{
						m_commandImpl.Cancel(m_connection.m_oracleConnectionImpl, num);
					}
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CommandTimeoutCallback, ex);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.CommandTimeoutCallback);
				}
			}
		}

		private void PopulateSubscriptionInfo(out OracleDependencyImpl orclDependencyImpl)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.PopulateSubscriptionInfo);
			}
			try
			{
				OracleDependency oracleDependency = null;
				orclDependencyImpl = null;
				if ((oracleDependency = OracleDependency.GetOracleDependencyFromNTFNId(m_NTFNReq.m_id)) == null)
				{
					return;
				}
				orclDependencyImpl = oracleDependency.m_orclDependencyImpl;
				if (!orclDependencyImpl.m_bIsRegistered)
				{
					if (oracleDependency.m_OracleRowidInfo == OracleRowidInfo.Exclude)
					{
						orclDependencyImpl.m_bExcludeRowId = true;
					}
					else if (oracleDependency.m_OracleRowidInfo == OracleRowidInfo.Include)
					{
						orclDependencyImpl.m_bIncludeRowId = true;
					}
					orclDependencyImpl.m_bQueryBasedNTFN = false;
					if (oracleDependency.m_bQueryBasedNTFN && m_connection.m_isDb11gR1OrHigher)
					{
						orclDependencyImpl.m_bQueryBasedNTFN = true;
					}
					oracleDependency.SetRegisterInfo(m_connection.m_oracleConnectionImpl.m_cs.m_userId, m_connection.DataSource, m_NTFNReq);
				}
				else if (oracleDependency.m_dataSource != m_connection.DataSource || oracleDependency.m_userName != m_connection.m_oracleConnectionImpl.m_cs.m_userId)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_DIFFERENT_CONNECTIONS));
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.PopulateSubscriptionInfo, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.PopulateSubscriptionInfo);
				}
			}
		}

		private void AddRefCursorParamToParamColl(RefCursorInfo cursorInfo)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.AddRefCursorParamToParamColl);
			}
			try
			{
				OracleParameter oracleParameter = new OracleParameter();
				oracleParameter.ParameterName = cursorInfo.name;
				oracleParameter.OracleDbType = OracleDbType.RefCursor;
				oracleParameter.Direction = cursorInfo.mode;
				if (m_parameters == null)
				{
					m_parameters = new OracleParameterCollection();
				}
				if (cursorInfo.position >= 0 && m_parameters.Count > cursorInfo.position)
				{
					m_parameters.Insert(cursorInfo.position, oracleParameter);
				}
				else
				{
					m_parameters.Add(oracleParameter);
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.AddRefCursorParamToParamColl, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.AddRefCursorParamToParamColl);
				}
			}
		}

		private string[] GetPlsqlOutput()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleCommand, OracleTraceFuncName.GetPlsqlOutput);
			}
			string[] array = null;
			try
			{
				if (m_connection == null)
				{
					throw new InvalidOperationException();
				}
				if (m_connection.m_connectionState != ConnectionState.Open)
				{
					throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
				}
				int num = ((!m_connection.m_isDb10gR2OrHigher) ? 255 : 32767);
				OracleCommand oracleCommand = new OracleCommand("BEGIN DBMS_OUTPUT.GET_LINES(:1, :2); END;", m_connection);
				oracleCommand.CommandType = CommandType.Text;
				OracleParameter oracleParameter = new OracleParameter();
				oracleParameter.DbType = DbType.String;
				oracleParameter.Direction = ParameterDirection.Output;
				oracleParameter.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
				oracleCommand.Parameters.Add(oracleParameter);
				OracleParameter oracleParameter2 = new OracleParameter();
				oracleParameter2.DbType = DbType.Int32;
				oracleParameter2.Direction = ParameterDirection.InputOutput;
				oracleCommand.Parameters.Add(oracleParameter2);
				oracleParameter2.Value = 1024;
				ArrayList arrayList = new ArrayList(32);
				while ((int)oracleParameter2.Value == 1024)
				{
					try
					{
						oracleParameter.Value = null;
						oracleParameter.Size = (int)oracleParameter2.Value;
						oracleParameter.ArrayBindSize = new int[(int)oracleParameter2.Value];
						for (int i = 0; i < (int)oracleParameter2.Value; i++)
						{
							oracleParameter.ArrayBindSize[i] = num;
						}
						oracleCommand.ExecuteNonQuery();
					}
					catch (Exception ex)
					{
						OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.GetPlsqlOutput, ex);
						throw;
					}
					arrayList.Add(oracleParameter.Value);
				}
				array = new string[(int)oracleParameter2.Value + (arrayList.Count - 1) * 1024];
				int num2 = 0;
				int j = 0;
				int num3 = 0;
				for (; j < arrayList.Count; j++)
				{
					string[] array2 = (string[])arrayList[j];
					num2 = ((j != arrayList.Count - 1) ? 1024 : ((int)oracleParameter2.Value));
					int num4 = 0;
					while (num4 < num2)
					{
						array[num3] = array2[num4];
						num4++;
						num3++;
					}
				}
				oracleCommand.Parameters.Clear();
				oracleCommand.Dispose();
				oracleCommand = null;
				return array;
			}
			catch (Exception ex2)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleCommand, OracleTraceFuncName.GetPlsqlOutput, ex2);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleCommand, OracleTraceFuncName.GetPlsqlOutput);
				}
			}
		}

		private void ValidateStatePriorToExecution()
		{
			if (m_disposed)
			{
				throw new ObjectDisposedException(GetType().Name);
			}
			if (m_connection == null)
			{
				throw new InvalidOperationException();
			}
			if (m_connection.m_connectionState != ConnectionState.Open)
			{
				throw new InvalidOperationException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.CON_CLOSED));
			}
			if (m_commandImpl == null)
			{
				m_commandImpl = GetInitializedCommandImpl();
				if (m_commandImpl == null)
				{
					throw new InvalidOperationException();
				}
			}
			m_commandImpl.m_arrayBindCount = m_arrayBindCount;
		}

		private OracleCommandImpl GetInitializedCommandImpl()
		{
			OracleCommandImpl oracleCommandImpl = null;
			if (m_connection != null && m_connection.m_oracleConnectionImpl != null)
			{
				oracleCommandImpl = m_connection.m_oracleConnectionImpl.getCommandImpl();
				oracleCommandImpl.m_addRowid = m_addRowId;
				oracleCommandImpl.m_addToStatementCache = m_addToStatementCache;
				oracleCommandImpl.m_arrayBindCount = m_arrayBindCount;
				oracleCommandImpl.m_bBindByName = m_bBindByName;
				oracleCommandImpl.m_fetchSize = m_fetchSize;
			}
			return oracleCommandImpl;
		}
	}
}
